package com.kun.companion;

import com.kun.companion.controller.HelloController;
import com.kun.companion.controller.TestController;
import com.kun.companion.core.AbstractApplication;
import com.kun.companion.core.context.impl.StageSingletonContext;
import com.kun.companion.core.util.ImageLoader;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author gzc
 */
public class Main extends AbstractApplication {
    private static final Logger log = LoggerFactory.getLogger(Main.class);

    public static void main(String[] args) throws Exception {
        run(Main.class, args, Main.class::getResource);
    }

    @Override
    protected Stage createAppStage() {
        return StageSingletonContext.getInstance(TestController.class).getStage();
    }

    @Override
    protected Image createIcon() {
        return ImageLoader.load("/app-icon.png");
    }

    @Override
    protected String[] loadPackages() {
        return new String[]{"com.kun.companion"};
    }

    @Override
    protected void doInit() throws Exception {
    }

    @Override
    protected void doStart(Stage stage) throws Exception {
        log.info("启动主窗口...");
        stage.show();
    }


}

